/*
 * ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
 * Without permission, no one has the right to obtain, disclose or use this software in any way.
 */

package ecarx.xsf.notificationcenter;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import ecarx.xsf.notificationcenter.push.NotificationPushFlavor;

public class TestActivity extends AppCompatActivity {
    String json1 = "{\n" +
            "    \"tts\": \"\",\n" +
            "    \"sourcePackage\": \"com.smart.dhu.shopping\",\n" +
            "    \"style\": {\n" +
            "        \"duration\": \"300\",\n" +
            "        \"rank\": \"1\",\n" +
            "        \"type\": \"6\"\n" +
            "    },\n" +
            "    \"id\": \"778247402446487552\",\n" +
            "    \"category\": \"system\",\n" +
            "    \"event\": [\n" +
            "        {\n" +
            "            \"package\": \"ecarx.notificationcenterui\",\n" +
            "            \"appType\": \"\",\n" +
            "            \"extral\": \"\",\n" +
            "            \"typeName\": \"\",\n" +
            "            \"action\": \"ecarx.notification.h5activity\",\n" +
            "            \"className\": \"ecarx.notificationcenterui.H5Activity\",\n" +
            "            \"id\": 0,\n" +
            "            \"packageName\": \"\",\n" +
            "            \"params\": [\n" +
            "                {\n" +
            "                    \"value\": \"activity\",\n" +
            "                    \"key\": \"type\"\n" +
            "                }\n" +
            "            ],\n" +
            "            \"uri\": \"https://www.bilibili.com/video/BV18e4y1n7Ci/?spm_id_from=333.1007.tianma.1-1-1.click\",\n" +
            "            \"bgUrl\": \"\"\n" +
            "        }\n" +
            "    ],\n" +
            "    \"content\": {\n" +
            "        \"detailTxt\": \"跳转测试打开H5\",\n" +
            "        \"text\": \"跳转测试打开H5\",\n" +
            "        \"title\": \"跳转测试打开H5\",\n" +
            "        \"btnInfo\": \"go\"\n" +
            "    }\n" +
            "}";
    String json2 = "{\"tts\":\"\",\"sourcePackage\":\"ecarx.xsf.notificationcenter\",\"style\":{\"duration\":\"300\",\"rank\":\"1\",\"type\":\"6\"},\"id\":\"737022347062640640\",\"category\":\"system\",\"event\":[{\"package\":\"ecarx.xsf.notificationcenter\",\"appType\":\"\",\"extral\":\"\",\"typeName\":\"\",\"action\":\"android.intent.action.MAIN\",\"className\":\"ecarx.xsf.notificationcenter.TestActivity\",\"id\":0,\"packageName\":\"ecarx.notificationcenterui\",\"params\":[{\"value\":\"activity\",\"key\":\"type\"}],\"uri\":\"www.baidu.com\",\"bgUrl\":\"\"}],\"content\":{\"detailTxt\":\"天天开心test\",\"text\":\"天天开心test\",\"title\":\"节日快乐test\",\"btnInfo\":\"go\"}}";

    EditText push1, push2;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        push1 = findViewById(R.id.edit_push1);
        push2 = findViewById(R.id.edit_push2);

        push1.setText(json1);
        push2.setText(json2);

        findViewById(R.id.push1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NotificationPushFlavor.getPushManager().handlePush(TestActivity.this, push1.getText().toString());
            }
        });

        findViewById(R.id.push2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NotificationPushFlavor.getPushManager().handlePush(TestActivity.this, push2.getText().toString());
            }
        });
    }

}